package cn.lcsjsxy.yxz.comprehensiveexercises1;

public class Account {

    //5.14
    //

    private int id; // 账号
    private double balance; // 余额
    private double nianlil; // 年利率

    public Account(int id) {
        this.id = id;
    }

    public Account(int id, double balance, double nianlil) {
        this.id = id;
        this.balance = balance;
        this.nianlil = nianlil;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double huoqunianlixi() {
        return nianlil;
    }

    public void huoqunianlixi(double nianlil) {
        this.nianlil = nianlil;
    }

    //管理
    public void withdraw (double amount){     // 取钱
        if(balance < amount){
            System.out.println("余额不足");
            return;
        }
        balance -= amount;
        System.out.println("成功取出: " + amount);
    }
    public void deposit (double amount){        //存钱
        if(amount > 0){
            balance += amount;
            System.out.println("成功存入: " + amount);
        }
    }




}
